/*
 *
 *  Copyright (C) 2009 GSyC/LibreSoft, Universidad Rey Juan Carlos
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see http://www.gnu.org/licenses/. 
 *
 *  Author : Roberto Calvo Palomino <rocapal@gsyc.es>
 *
 */

package com.LibreGeoSocial.Api.Layers;

import java.io.Serializable;
import java.util.ArrayList;

import android.graphics.Bitmap;
import android.os.Handler;

import com.LibreGeoSocial.Api.GeoNode;
import com.LibreGeoSocial.Api.LibreGeoSocial;

public abstract class GenericLayer implements Serializable {

	/** 
	 * 
	 */
	private static final long serialVersionUID = -6501648066678686473L;
	
	private String mName;
	private Double mDistance;
	private String mPattern;
	private Integer mPage;
	protected ArrayList<GeoNode> mArrayNodes = new ArrayList<GeoNode>();
	
	public GenericLayer (String name, Double distance, String pattern)
	{
		mName = name;
		mDistance = distance;
		mPattern = pattern;
		mPage = 1;
	}
	
	public String getNameLayer() {
		return mName;
	}
	public void setNameLayer(String mName) {
		this.mName = mName;
	}
	public Double getDistance() {
		return mDistance;
	}
	public void setDistance(Double mDistance) {
		this.mDistance = mDistance;
	}
	public String getPattern() {
		return mPattern;
	}
	public void setPattern(String mPattern) {
		this.mPattern = mPattern;
	}

	public ArrayList<GeoNode> getNodes()
	{
		return mArrayNodes;
	}
	
	public void setNodes ( ArrayList<GeoNode> nodes )
	{
		mArrayNodes = nodes;
	}
	
	public Bitmap getIcon ()
	{
		return LibreGeoSocial.getInstance().getBitmap( 
					"layer/" + getNameLayer() + "/icon/" );
	}

	public void resetPagination()
	{
		mPage=1;
	}
	
	public void nextPage()
	{
		mPage++;
	}
	
	public void previousPage()
	{
		if (mPage>1)
			mPage--;
	}
	
	public Integer getCurrentPage()
	{
		return mPage;
	}
	
	public abstract Thread getThreadtoUpdate ( Handler hNotification, String[] categories);
	
	public abstract String[] getCategories ();
	

}
